//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.tool.btn;

import com.tool.image.ImageMixDeal;
import com.tool.role.ExpUtil;
import com.tool.role.RoleLingFa;
import com.tool.tcpimg.UIUtils;
import come.tool.JDialog.TiShiUtil;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import org.come.Frame.OptionsJframe;
import org.come.Frame.PartnerJframe;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.PartnerMainJpanel;
import org.come.entity.Pal;
import org.come.model.Lingbao;
import org.come.model.PalData;
import org.come.until.UserMessUntil;
import org.come.until.Util;

public class LingbaoPagingBtn extends MoBanBtn {
    private int btnname;

    public LingbaoPagingBtn(String iconpath, int type, int btnname, String text) {
        super(iconpath, type);
        this.btnname = btnname;
        if (text != null) {
            this.setText(text);
            this.setFont(UIUtils.TEXT_FONT);
            this.setForeground(Color.yellow);
            this.setVerticalTextPosition(0);
            this.setHorizontalTextPosition(0);
        }

    }

    public LingbaoPagingBtn(String iconpath, int type, Color[] colors, Font font, int btnname, String text) {
        super(iconpath, type, colors);
        this.btnname = btnname;
        if (text != null) {
            this.setText(text);
            this.setFont(font);
            this.setVerticalTextPosition(0);
            this.setHorizontalTextPosition(0);
        }

    }





    @Override
    public void nochoose(MouseEvent e) {
        if (ImageMixDeal.userimg.getRoleShow().getBooth_id() != null) {
            ZhuFrame.getZhuJpanel().addPrompt2("摆摊状态不可以操作！");
            return;
        }
        Lingbao lingbao;
        switch(this.btnname) {
            case 0:
                RoleLingFa.getRoleLingFa().lingFan(false);
                break;
            case 1:
                RoleLingFa.getRoleLingFa().lingFan(true);
                break;
            case 2:
                RoleLingFa.getRoleLingFa().faFan(false);
                break;
            case 3:
                RoleLingFa.getRoleLingFa().faFan(true);
                break;
            case 4:
                lingbao = RoleLingFa.getRoleLingFa().getChoseBao();
                if (lingbao != null) {
                    if (lingbao != null) {
                        OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(TiShiUtil.lingkang, lingbao, "#Y确定要将花  #G200000 #Y银两随机灵宝附加抗性吗??");
                    }
                } else {
                    ZhuFrame.getZhuJpanel().addPrompt("先选中需要转换抗性的灵宝或者法宝");
                }
                break;
            case 5:
                if (Util.isCanBuyOrno()) {
                    return;
                }

                lingbao = RoleLingFa.getRoleLingFa().getChoseBao();
                if (lingbao != null) {
                    if ("法宝".equals(lingbao.getBaotype())) {
                        ZhuFrame.getZhuJpanel().addPrompt2("不能删除法宝");
                        return;
                    }

                    if (lingbao.getFushis() != null && !"".equals(lingbao.getFushis())) {
                        ZhuFrame.getZhuJpanel().addPrompt2("删除前先卸下符石");
                    } else {
                        OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(TiShiUtil.lingDiscatd, lingbao, "#Y确定要将该灵宝删除吗？？？");
                    }
                } else {
                    ZhuFrame.getZhuJpanel().addPrompt("先选中需要删除的灵宝或者法宝");
                }
            case 6:
            case 7:
            case 8:
            case 9:
            default:
                break;
            case 10:
                if (Util.isCanBuyOrno()) {
                    return;
                }

                lingbao = RoleLingFa.getRoleLingFa().getChoseBao();
                if (lingbao != null) {
                    int lvl = lingbao.getLingbaolvl().intValue();
                    long exp = lingbao.getLingbaoexe().longValue();
                    long maxexp = ExpUtil.LFExp(lvl);
                    if (lvl % 30 != 0 || exp < maxexp || lvl == 0) {
                        ZhuFrame.getZhuJpanel().addPrompt2("还未达到突破条件");
                        return;
                    }

                    StringBuffer buffer = new StringBuffer();
                    buffer.append("#Y你是否要消耗#R");
                    buffer.append(lvl / 5);
                    buffer.append("#Y个灵宝天威印进行突破");
                    OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(TiShiUtil.lingtupo, lingbao, buffer.toString());
                } else {
                    ZhuFrame.getZhuJpanel().addPrompt("先选中需要突破的灵宝或者法宝");
                }
            case 11:
                /**判断是否解锁*/
                if(Util.isCanBuyOrno()){
                    return;
                }
                lingbao = RoleLingFa.getRoleLingFa().getChoseBao();
                if (lingbao==null) {
                    ZhuFrame.getZhuJpanel().addPrompt2("没有选中灵宝");
                    return;
                }
                PartnerMainJpanel mainJpanel = PartnerJframe.getPartnerJframe().getPartnerMainJpanel();
                if (mainJpanel.getPalDataChooseId() < 0) {
                    ZhuFrame.getZhuJpanel().addPrompt2("请选择一个伙伴");
                    return;
                }
                Pal pidGetPal = mainJpanel.pidGetPal(mainJpanel.getPalDataChooseId());
                if (pidGetPal == null) {
                    ZhuFrame.getZhuJpanel().addPrompt2("请选中一个伙伴");
                    return;
                }
                PalData palData = UserMessUntil.getPalData(pidGetPal.getpId());
                String name = palData.getName();
                if(pidGetPal.getLingbao()!=null) {
                    ZhuFrame.getZhuJpanel().addPrompt2("伙伴【#G"+name+"#Y】已有灵宝，请先取回");
                    return;
                }
                StringBuffer buffer = new StringBuffer();
                buffer.append("#Y你是否要将灵宝#R");
                buffer.append(lingbao.getBaoname());
                buffer.append("#Y装备到伙伴#G"+name);
                OptionsJframe.getOptionsJframe().getOptionsJpanel().showBox(TiShiUtil.lingToPal, lingbao, buffer.toString());
        }
    }

    @Override
    public void chooseyes() {
    }

    @Override
    public void chooseno() {
    }
}
